package com.sakura.seckill.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.sakura.seckill.pojo.Order;
import com.sakura.seckill.pojo.SeckillOrder;
import com.sakura.seckill.pojo.User;
import com.sakura.seckill.vo.GoodsVo;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author sakura
 * @since 2022-08-16
 */
public interface ISeckillOrderService extends IService<SeckillOrder> {


    /**
     * 秒杀
     * @param user
     * @param goods
     * @return
     */
    Order seckill(User user, GoodsVo goods);

    /**
     * 功能描述：获取秒杀结果
     *
     * orderId：成功：
     *      -1：失败
     *       0：排队中
     */
    Long getResult(User user, Long goodsId);

    /**
     * 功能描述：获取秒杀地址
     * @param user
     * @param goodsId
     * @return
     */
    String createPath(User user, Long goodsId);

    /**
     * 校验秒杀地址
     * @param user
     * @param goodsId
     * @return
     */
    boolean checkPath(User user, Long goodsId,String path);

    /**
     * 校验验证码
     * @param user
     * @param goodsId
     * @param captcha
     * @return
     */
    boolean checkCaptcha(User user, Long goodsId, String captcha);
}
